<?php

//注册类

class Reg extends User{
	//写一个构造方法接收注册信息
	public function __construct($_userName,$_passWord,$_notPassWord,$_eMail){
        $this->_username = $_userName;
        $this->_password = $_passWord;
        $this->_notpassword = $_notPassWord;
        $this->_email = $_eMail;
	}
	


	//将信息注册到xml里
	public function _query(){
        //xml字符串
        $_xml =<<<_xml
<?xml version="1.0" encoding="utf-8" ?>
<user>
   <username>$this->_username</username>
   <password>$this->_password</password>
   <notpassword>$this->_notpassword</notpassword>
   <email>$this->_ema                                                                                                                                                                                                                                      il</email>
</user>
_xml;
        
        //创建simplexml类
        $_sxe = new SimpleXMLElement($_xml);
        
        //生成xml
        $_sxe->asXML('user.xml');

        //注册成功跳转到login.inc.php页面
        //直接调用静态方法执行
        Tool::_alerLocation('恭喜您，注册成功','?index=login');
	}

    //验证注册信息
	public function _check(){
		//注册信息不能为空即可
		if(empty($this->_username) || empty($this->_password) || empty($this->_notpassword) || 
		    empty($this->_email)){
		        return false;
		}

		return true;	
		
	}
}














